import os, sys, wordninja

def main(a):
    with open(a, encoding='utf-8', mode='r') as f:
        v= f.read()
    v2= []
    for i in v.split('\n'):
        v2.append(' '.join(wordninja.split(i)))
    v3= '\n'.join(v2)
    with open(os.path.join('outputs', os.path.basename(a)),mode='w', encoding='utf8') as f:
        f.write(v3)

if __name__ == "__main__":
    args = sys.argv
    try:
        os.mkdir('outputs')
    except:
        pass
    for i in args[1:]:
        main(i)
